home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: ShiftRGB.ieb 2.0, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 18/1 1997 Stockholm/Sweden ** ** Swaps/copies brightness data in the R, G and B channels. ** Based on the IE script ShiftRGB.rexx 3.0. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' 'IE_TO_FRONT' if command = '' then do 'FORM "ShiftRGB" " Accept | Cancel "', ' TEXT,"Swaps and/or copies brightness data between color channels."', ' TEXT,"Red channel will inherit data from..."', ' CYCLE,"Channel:","Red|Green|Blue",0', ' TEXT,"Green channel will inherit data from..."', ' CYCLE,"Channel:","Red|Green|Blue",1', ' TEXT,"Blue channel will inherit data from..."', ' CYCLE,"Channel:","Red|Green|Blue",2' parse var result ok Rd Gr Bl . if ok = 0 then exit end else do 'REQUEST' '"This batch script does not have'd2c(10)'any settings for the last frame."' '" OK "' Rd='none'; Gr='none'; Bl='none' end back = '#'Rd '#'Gr '#'Bl return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' parse var options '#' c.0 '#' c.1 '#' c.2 . 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result MergeImage = '' do i = 0 to 2 if c.i = 0 then 'BRIGHTNESS' LoadImage '-255' 'GREEN BLUE' if c.i = 1 then 'BRIGHTNESS' LoadImage '-255' 'RED BLUE' if c.i = 2 then 'BRIGHTNESS' LoadImage '-255' 'RED GREEN' Image = RESULT if (i*85-c.i*85) ~= 0 then do 'HUE' Image (i*85-c.i*85) HueImage = RESULT 'CLOSE' Image end else HueImage = Image if MergeImage ~= '' then do 'MARK' HueImage 'PRIMARY' 'MARK' MergeImage 'SECONDARY' 'COMPOSITE' 0 0 'ADD' Image = RESULT 'CLOSE' HueImage 'CLOSE' MergeImage MergeImage = Image end else MergeImage = HueImage end OutputImage = MergeImage 'CLOSE' LoadImage if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'